import { $get, $put } from '@js/authRequest'

// 获取送达表格数据
export async function getTableList (topicid) {
  const res = await $get('/api/xapc/deliver', {
    topicid
  })
  if (res.status !== 1) {
    throw new Error(res.message)
  }
  return res.data.map(li => {
    li.key = li.id
    return li
  })
}

// 发出电子送达
export async function sendElectronicService (deliverid) {
  const res = await $put('/api/xapc/deliver/sendDigitalDeliver', {
    deliverid
  })
  if (res.status !== 1) {
    throw new Error(res.message)
  }
  return res.data
}
